package gameserver.model.gameobjects.stats;

public class Stat
{
	private StatEnum type;
	private int origin;
	private int base;
	private int old;

	public Stat(StatEnum _type, int _origin)
	{
		this.type = _type;
		this.origin = _origin;
		this.base = _origin;
		this.old = 0;
	}

	public Stat(StatEnum _type)
	{
		this(_type, 0);
	}

	public StatEnum getType()
	{
		return this.type;
	}

	public void increase(int amount)
	{
		if (type == StatEnum.CHARM)
		{
			this.base += amount;
		} 
		else
		{
			this.base *= amount;
		}
	}

	public void set(int amount)
	{
		this.base = amount;
	}

	public int getOrigin()
	{
		return origin;
	}

	public int getBase()
	{
		return base;
	}


	public int getOld()
	{
		return old;
	}

	public int getCurrent()
	{
		return this.base ;
	}

	public void reset()
	{
		old = base;
		base = origin;
	}

	@Override
	public String toString()
	{
		final String s = type + ":" + base;
		return s;
	}
}
